home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / doc / CrtTrace.3 < prev    next >
Text File  |  1993-02-14  |  5KB  |  113 lines

  1. '\"
  2. '\" Copyright 1989 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. .so man.macros
  11. .HS Tcl_CreateTrace tcl
  12. .BS
  13. .SH NAME
  14. Tcl_CreateTrace, Tcl_DeleteTrace \- arrange for command execution to be traced
  15. .SH SYNOPSIS
  16. .nf
  17. \fB#include <tcl.h>\fR
  18. .sp
  19. Tcl_Trace
  20. \fBTcl_CreateTrace\fR(\fIinterp, level, proc, clientData\fR)
  21. .sp
  22. \fBTcl_DeleteTrace\fR(\fIinterp, trace\fR)
  23. .SH ARGUMENTS
  24. .AS Tcl_CmdTraceProc (clientData)()
  25. .AP Tcl_Interp *interp in
  26. Interpreter containing command to be traced or untraced.
  27. .AP int level in
  28. Only commands at or below this nesting level will be traced.  1 means
  29. top-level commands only, 2 means top-level commands or those that are
  30. invoked as immediate consequences of executing top-level commands
  31. (procedure bodies, bracketed commands, etc.) and so on.
  32. .AP Tcl_CmdTraceProc *proc in
  33. Procedure to call for each command that's executed.  See below for
  34. details on the calling sequence.
  35. .AP ClientData clientData in
  36. Arbitrary one-word value to pass to \fIproc\fR.
  37. .AP Tcl_Trace trace in
  38. Token for trace to be removed (return value from previous call
  39. to \fBTcl_CreateTrace\fR).
  40. .BE
  41.  
  42. .SH DESCRIPTION
  43. .PP
  44. \fBTcl_CreateTrace\fR arranges for command tracing.  From now on, \fIproc\fR
  45. will be invoked before Tcl calls command procedures to process
  46. commands in \fIinterp\fR.  The return value from
  47. \fBTcl_CreateTrace\fR is a token for the trace,
  48. which may be passed to \fBTcl_DeleteTrace\fR to remove the trace.  There may
  49. be many traces in effect simultaneously for the same command interpreter.
  50. .PP
  51. \fIProc\fR should have arguments and result that match the
  52. type \fBTcl_CmdTraceProc\fR:
  53. .nf
  54. .sp
  55. .RS
  56. typedef void Tcl_CmdTraceProc(
  57. .RS
  58. ClientData \fIclientData\fR,
  59. Tcl_Interp *\fIinterp\fR,
  60. int \fIlevel\fR,
  61. char *\fIcommand\fR,
  62. Tcl_CmdProc *\fIcmdProc\fR,
  63. ClientData \fIcmdClientData\fR,
  64. int \fIargc\fR,
  65. char *\fIargv\fR[]));
  66. .sp
  67. .RE
  68. .RE
  69. .fi
  70. The \fIclientData\fP and \fIinterp\fP parameters are
  71. copies of the corresponding arguments given to \fBTcl_CreateTrace\fR.
  72. \fIClientData\fR typically points to an application-specific
  73. data structure that describes what to do when \fIproc\fR
  74. is invoked.  \fILevel\fR gives the nesting level of the command
  75. (1 for top-level commands passed to \fBTcl_Eval\fR by the application,
  76. 2 for the next-level commands passed to \fBTcl_Eval\fR as part of parsing
  77. or interpreting level-1 commands, and so on).  \fICommand\fR
  78. points to a string containing the text of the
  79. command, before any argument substitution.
  80. \fICmdProc\fR contains the address of the command procedure that
  81. will be called to process the command (i.e. the \fIproc\fR argument
  82. of some previous call to \fBTcl_CreateCommand\fR) and \fIcmdClientData\fR
  83. contains the associated client data for \fIcmdProc\fR (the \fIclientData\fR
  84. value passed to \fBTcl_CreateCommand\fR).  \fIArgc\fR and \fIargv\fR give
  85. the final argument information that will be passed to \fIcmdProc\fR, after
  86. command, variable, and backslash substitution.
  87. \fIProc\fR must not modify the \fIcommand\fR or \fIargv\fR strings.
  88. .PP
  89. Tracing will only occur for commands at nesting level less than
  90. or equal to the \fIlevel\fR parameter (i.e. the \fIlevel\fR
  91. parameter to \fIproc\fR will always be less than or equal to the
  92. \fIlevel\fR parameter to \fBTcl_CreateTrace\fR).
  93. .PP
  94. Calls to \fIproc\fR will be made by the Tcl parser immediately before
  95. it calls the command procedure for the command (\fIcmdProc\fR).  This
  96. occurs after argument parsing and substitution, so tracing for
  97. substituted commands occurs before tracing of the commands
  98. containing the substitutions.  If there is a syntax error in a
  99. command, or if there is no command procedure associated with a
  100. command name, then no tracing will occur for that command.  If a
  101. string passed to Tcl_Eval contains multiple commands (bracketed, or
  102. on different lines) then multiple calls to \fIproc\fR will occur,
  103. one for each command.  The \fIcommand\fR string for each of these
  104. trace calls will reflect only a single command, not the entire string
  105. passed to Tcl_Eval.
  106. .PP
  107. \fBTcl_DeleteTrace\fR removes a trace, so that no future calls will be
  108. made to the procedure associated with the trace.  After \fBTcl_DeleteTrace\fR
  109. returns, the caller should never again use the \fItrace\fR token.
  110.  
  111. .SH KEYWORDS
  112. command, create, delete, interpreter, trace
  113.